#define DEBUG
#include <cstdio>

using namespace std;

typedef long long ll;

const int maxn=1000000;

int main() {
  freopen("building.in", "r", stdin);
  freopen("building.out", "w", stdout);

  static int h[maxn+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%d", h+i);
  }

  h[2] -= h[1]/2+(h[1]%2*2);
  ll ans=h[1]/2+h[1]%2, cnt=h[1]/2;
  h[1] = 0;
  for (int i=2; i<n; i++) {
		int temp=0;
    if (h[i]>0) {
      if (h[i]<cnt*3) {
        ans += h[i]/3;
				temp = h[i]/3*2;
        h[i]%=3;
      } else {
        ans += cnt;
        h[i]-=cnt*3;
				temp = cnt*2;
      }
    }
    cnt = temp;
    if (h[i]>=2) {
      ans+=h[i]/2;
      cnt+=h[i]/2;
      h[i+1]-=h[i]/2;
      h[i]%=2;
    }
    if (h[i]==1) {
      ans++;
      h[i+1]-=2;
      h[i]-=1;
    }
  }

  if (h[n]>0) {
    if (h[n]<cnt*3) {
      ans += h[n]/3;
      h[n]%=3;
    } else {
      ans += cnt;
      h[n] -= cnt*3;
    }
    ans += h[n]/2+h[n]%2;
  }

  printf("%lld", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
